<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/10/28
 * Time: 10:14
 */
namespace app\team\model;

use think\Model;
use think\Request;
use think\Db;
use think\Session;

class Good extends Model
{
    /**展示商品列表
     * @param $where
     * @param $offset
     * @param $limit
     * @return false|\PDOStatement|string|\think\Collection
     */
    static function getGoodsList($where, $offset, $limit){
        $res = Db::name('group_tour')->where($where)->limit($offset,$limit)->order('id','desc')->select();
        return $res;
    }

    /**商品总数
     * @param $where
     * @return int|string
     */
    static function  getGoodsCount($where)
    {
        return Db::name('group_tour')->where($where)->count();
    }

    /** 添加出行详情
     * @param $data
     * @return int|string
     */
    static function travel($data)
    {
        return Db::name('gtour_journey')->insertGetId($data);
    }

    /*
     * 查看该商品下的图片
     */
    static function getGtImage($id,$offset,$limit)
    {
        return Db::name('gtour_tour_img')->where('gt_id',$id)->where('is_del',0)->select();
    }

    /**获取图片总数
     * @param $id
     * @return int|string
     */
    static function getGtImageCount($id)
    {
        return Db::name('gtour_tour_img')->where('gt_id',$id)->where('is_del',0)->count();
    }
}